/*
 * animationSample.fx
 *
 * Created on 24-dic-2009, 0:53:43
 */

package ProgramSamples;

import javafx.animation.Interpolator;
import javafx.animation.Timeline;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.shape.ArcTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.effect.Lighting;
import javafx.scene.effect.light.DistantLight;


var x: Number;

Timeline {
  repeatCount: Timeline.INDEFINITE
  autoReverse: true
  keyFrames: [
   at (0s) {x => 0.0},
   at (5s) {x => 800.0 tween Interpolator.LINEAR}
  ]
}.play();

var y: Number;

Timeline {
  repeatCount: Timeline.INDEFINITE
  autoReverse: true
  keyFrames: [
    at (0s) {y => 0.0},
    at (5s) {y => 600.0 tween Interpolator.LINEAR},
  ]
}.play();

Stage{
    title: "Cloud"
    scene: Scene{
            fill: Color.WHITE
            content:[
                ImageView{
                    image: Image{
                        url: "http://img442.imageshack.us/img442/6520/4c135b4b2fb213e1298b2a5wl4.jpg"
                    }},
                Path {
                    effect: Lighting{
                            light: DistantLight{
                                    azimuth: 90
                            }
                    }
                    translateX: bind x
                    translateY: bind y
                    stroke: Color.DODGERBLUE
                    fill: LinearGradient {
                        startX:60,
                        startY:10,
                        endX:10
                        endY:80 ,
                        proportional: false
                        stops: [
                            Stop {offset: 0.0 color: Color.DODGERBLUE},
                            Stop {offset: 0.5 color: Color.LIGHTSKYBLUE},
                            Stop {offset: 1.0 color: Color.WHITE}
                        ]
                    }
                    elements: [
                        MoveTo {x: 15 y: 15 },
                        ArcTo {x: 50 y: 10 radiusX: 20 radiusY: 20 sweepFlag: true},
                        ArcTo {x: 70 y: 20 radiusX: 20 radiusY: 20 sweepFlag: true},
                        ArcTo {x: 50 y: 60 radiusX: 20 radiusY: 20 sweepFlag: true},
                        ArcTo {x: 20 y: 50 radiusX: 10 radiusY: 5 sweepFlag: true},
                        ArcTo {x: 15 y: 15 radiusX: 10 radiusY: 10 sweepFlag: true},
                    ]
                }//Path
            ]
     }//Scene
}//Stage